home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98a.txt
/
000074_icon-group-sender _Mon Mar 2 12:49:21 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
3KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id MAA19841
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 2 Mar 1998 12:49:20 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA03042; Mon, 2 Mar 1998 12:49:20 -0700
Date: Mon, 2 Mar 1998 09:35:34 -0800
From: kwalker@sfo.harbinger.com (Ken Walker)
Message-Id: <199803021735.JAA19946@varda.premenos.com>
To: icon-group@optima.CS.Arizona.EDU
Subject: Re: Translation into C
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Md5: BTPFMQXQOZEgPScV7e5NjQ==
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 2167
I'd like to start by stepping back and looking at what it means
for a program to be interpreted. In some sense, all code is interpreted;
iterpretation can be done at several levels:
1) keep program as text and interpret with a software
interpreter
2) parse program and interpret the syntax tree, symbol table,
etc. with a software interpreter
3) convert program to byte code for an abstract machine and
interpret with a software interpreter
4) convert program to machine code and interpret with a hardware
interpeter (CPU)
The Icon interpreter uses method 3 and the Icon compiler uses method 4.
Clearly software interpeters have some overhead, but with Icon
and some other "interpreted" languages, the software interpreter
loop is only a part of the overhead. Much of the cost comes from the
generality built into the run time support system for the language.
The Icon compiler is able to do some tailoring of the run time system
using information from type inferencing [it can typically determine
a unique type for 80% of the operands to build-in operations and
eliminate corresponding type checks]. If you study the code produced
by the compiler, it is not hard to find places were more optimizations
can be done. For example, the compiler makes no attempt to tailor
data structures to the needs of the program. Lists are always doublely
ended queques regardless of how you use them.
Simply translating Icon programs into C, helps some, but you need a
lot of sophisticated analysis and clever optimization if you want
to produce a C program that comes anywhere near a hand-coded one.
Even then, the C programmer may have information about the problem
domain that cannot be deduced from the Icon code by any analysis.
The C programs produced by the current Icon compiler run considerably
faster than interpreted program but appear to have a ways to go to match
hand-coded C. If someone has time, it would be interesting to compare
compiled Icon programs to hand-coded C [unfortunately, I've never
found the time...].
Ken Walker, kwalker@sfo.harbinger.com
Harbinger Coporation, Concord, Ca. 94520